﻿using System;
using System.Text;
using System.Collections.Generic;

namespace CeA.Reports.Atendimento.Web.WebControls {
    [Serializable]
    public class FiltroServicoEventArgs : EventArgs {
        private int m_ano;
        private int m_mes;
        private bool m_geraGrafico;
        private bool m_exportaExcel;
        private List<int> m_servicos;
        private List<int> m_lojas;
        private List<int> m_regiao;
        private List<int> m_rfs;

        public FiltroServicoEventArgs()                             {
            m_servicos = new List<int>();
            m_lojas = new List<int>();
            m_regiao = new List<int>();
            m_rfs = new List<int>();
        }

        public FiltroServicoEventArgs(int ano, int mes)             {
            m_ano = ano;
            m_mes = mes;
        }

        public void addServico(int id)                              {
            m_servicos.Add(id);
        }

        public void addLoja(int id)                                 {
            m_lojas.Add(id);
        }

        public void addRegiao(int id) {
            m_regiao.Add(id);
        }

        public void addRfs(int id) {
            m_rfs.Add(id);
        }

        /// <summary>
        /// Returns a <see cref="System.String"/> that represents this instance.
        /// </summary>
        /// <returns>
        /// A <see cref="System.String"/> that represents this instance.
        /// </returns>
        public override string ToString()                           {
            StringBuilder sb = new StringBuilder();

            string[] lojaString = new string[m_lojas.Count];
            int i = 0;
            foreach (int loja in m_lojas.ToArray()) {
                lojaString[++i] = loja.ToString();
            }

            string[] regiaoString = new string[m_regiao.Count];
            int j = 0;
            foreach (int regiao in m_regiao.ToArray())
            {
                regiaoString[++j] = regiao.ToString();
            }

            string[] rfsString = new string[m_rfs.Count];
            int l = 0;
            foreach (int rfs in m_rfs.ToArray())
            {
                regiaoString[++l] = rfs.ToString();
            }

            sb.AppendFormat("{0}@", base.ToString());
            sb.AppendFormat("[m_loja=[{0}; ",  string.Join(",", lojaString) + "];");
            sb.AppendFormat("[m_regiao=[{0}; ", string.Join(",", regiaoString) + "];");
            sb.AppendFormat("[m_rfs=[{0}; ", string.Join(",", rfsString) + "];");
            sb.AppendFormat(" m_ano={0}; ", m_ano);
            sb.AppendFormat(" m_mes={0}]", m_mes);

            return sb.ToString();
        }

        #region -- GETTERS/SETTERS --------------------------------------------
        public List<int> Lojas {
            get { return m_lojas; }
            set { m_lojas = value; }
        }

        public List<int> Regiao
        {
            get { return m_regiao; }
            set { m_regiao = value; }
        }

        public List<int> Rfs
        {
            get { return m_rfs; }
            set { m_rfs = value; }
        }

        public List<int> Servicos {
            get { return m_servicos; }
            set { m_servicos = value; }
        }

        public int Ano {
            get { return m_ano; }
            set { m_ano = value; }
        }

        public int Mes {
            get { return m_mes; }
            set { m_mes = value; }
        }


        public bool GeraGrafico {
            get { return m_geraGrafico; }
            set { m_geraGrafico = value; }
        }


        public bool ExportaRelatorio {
            get { return m_exportaExcel; }
            set { m_exportaExcel = value; }
        }
        #endregion
    }
}
